home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / tcprogud.sit / TC Prog Guide / card_22415.txt < prev    next >
Text File  |  1991-02-27  |  984b  |  30 lines

  1. -- card: 22415 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 4755
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 7
  9. ----- text -----
  10. 59
  11.  
  12. -- part contents for background part 4
  13. ----- text -----
  14. An ARRAY is a sequence of values of a given data type, arranged contiguously in memory.  Arrays are declared by following the identifier with an integer constant enclosed in [] brackets.  To declare an array of 10 floats requires:
  15.  
  16.     float    f_array[10];
  17.  
  18. Individual ELEMENTS of an array are accessed using the index in brackets.  Indexing begins at 0, so in the above example, elements f_array[0] through f_array[9] are allocated appropriately, but f_array[10] should not be accessed.
  19.  
  20.     f_array[5] = 100.;
  21.  
  22. Multi-dimensional arrays are declared using the following syntax:
  23.  
  24.     float    f_array[10] [10];
  25.  
  26. This declares a 10 by 10 array.  The indexing begins with 0 for both rows and columns.
  27.  
  28. -- part contents for background part 6
  29. ----- text -----
  30. 2.3  Arrays